﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Server
{
    public class CAccount
    {
        private string _taikhoan;
        private string _matkhau;
        private string _truso;
        private string _diachi;
        private string _dienthoai;
        private string _email;

        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }

        public CAccount()
        {
        }


        public string Taikhoan
        {
            get { return _taikhoan; }
            set { _taikhoan = value; }
        }
        public string Matkhau
        {
            get { return _matkhau; }
            set { _matkhau = value; }
        }
        public string Truso
        {
            get { return _truso; }
            set { _truso = value; }
        }
        public string Diachi
        {
            get { return _diachi; }
            set { _diachi = value; }
        }
        public string Dienthoai
        {
            get { return _dienthoai; }
            set { _dienthoai = value; }
        }

        override public string ToString()
        {
            string str = String.Empty;
            str = String.Concat(str, "Taikhoan = ", Taikhoan, "\r\n");
            str = String.Concat(str, "Matkhau = ", Matkhau, "\r\n");
            str = String.Concat(str, "Truso = ", Truso, "\r\n");
            str = String.Concat(str, "Diachi = ", Diachi, "\r\n");
            str = String.Concat(str, "Dienthoai = ", Dienthoai, "\r\n");
            str = String.Concat(str, "Email = ", Email, "\r\n");

            return str;
        }

        public CAccount(System.Xml.XmlNodeList childnode)
        {
            try
            {
                _taikhoan = childnode.Item(0).InnerText.Trim();
                _matkhau = childnode.Item(1).InnerText.Trim();
                _truso = childnode.Item(2).InnerText.Trim();
                _diachi = childnode.Item(3).InnerText.Trim();
                _dienthoai = childnode.Item(4).InnerText.Trim();
                _email = childnode.Item(5).InnerText.Trim();
            }
            catch(Exception c)
            {
                throw new Exception("Định dạng CSDL không đúng");
            }
        }
    }
}
